//
//  TMSearchReaultCell.m
//  国学培训用户端
//
//  Created by Tao Li on 2018/7/10.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "TMSearchReaultCell.h"
#import "TMSearchModel.h"
@implementation TMSearchReaultCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.contentView.layer.borderWidth = 1.0f;
    self.contentView.layer.borderColor = [UIColor hx_colorWithHexRGBAString:@"F7F7F7"].CGColor;
}
- (void)setIsCourse:(BOOL)isCourse{
    _isCourse = isCourse;
}
- (void)setModel:(TMSearchModel *)model{
    _model = model;
    self.courseImage.contentMode = UIViewContentModeScaleAspectFill;
    self.courseImage.clipsToBounds = YES;
    if (self.isCourse == YES) {
        [self.courseImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithBaseUrl:model.userimage]] placeholderImage:kPlaceholder];
        self.priceLabel.text = [NSString stringWithFormat:@"销量:%ld",model.sale];
        self.leaveLabel.hidden = YES;
        self.leaveLabel.text = [NSString stringWithFormat:@"销量:%ld",model.sale];
        self.addressLabel.text = [NSString stringWithFormat:@"地址:%@", model.address];
        self.courseName.text = model.username;
    }else{
        [self.courseImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithBaseUrl:model.pic[0]]] placeholderImage:kPlaceholder];
        self.leaveLabel.hidden = NO;
        self.priceLabel.text = [NSString stringWithFormat:@"价格:%.02f元",model.price];
        self.leaveLabel.text = [NSString stringWithFormat:@"销量:%ld",model.sale];
        self.addressLabel.text = [NSString stringWithFormat:@"地址:%@", model.address];
        self.courseName.text = model.name;
    }
    
}
@end
